package com.hopes.bizz.poll.common.constant.enums;

/**
 * @author lyb
 * @version 1.0
 * @description: 数据类型枚举
 * @date 2023/9/26 16:51
 */
public enum OmHisDataTypeEnums {

    RT(1, "poll_rt_data_his"),
    MIN(2, "poll_min"),
    HOUR(3, "poll_hour"),
    DAY(4, "poll_day"),
    MONTH(5, "poll_month"),
    YEAR(6, "poll_year"),
    ;

    OmHisDataTypeEnums(Integer code, String table) {
        this.code = code;
        this.table = table;
    }

    Integer code;
    String table;


    public Integer getCode() {
        return code;
    }

    public String getTable() {
        return table;
    }

    public static String getTableByCode(Integer code) {
        for (OmHisDataTypeEnums dataTypeEnum : OmHisDataTypeEnums.values()) {
            if (dataTypeEnum.code.equals(code)) {
                return dataTypeEnum.table;
            }
        }
        return null;
    }
}
